package com.yzd.learnjava.arrays;

import java.util.Arrays;
import java.util.Random;

import com.yzd.learnjava.util.Print;

public class IceCream {
	private static Random random = new Random(47);
	static final String[] FLAVORS = {
			"Chocolate","Strawbery","Vanilla Fudge Wsirl","Mint Chip","Mocha Almod Fudge","Rum Raisin",
			"Praline Cream", "Mud Pie"};
	public static String[] flavorsSet(int n) {
		if(n > FLAVORS.length) {
			return null;
		}
		
		String[] results = new String[n];
		boolean[] picked = new boolean[FLAVORS.length];
		for(int i = 0 ; i < n; i++) {
			int t ;
			do {
				t = random.nextInt(FLAVORS.length);
			}while(picked[t]);
			results[i] = FLAVORS[t];
			picked[t] = true;
		}
		return results;
	}
	
	
	public static void main(String[] args) {
		for(int i = 0 ; i < 7 ; i++) {
			Print.print(Arrays.toString(flavorsSet(3)));
		}
	}
}
